<?php

function GetLanguages( )
{
	$Items = array( );
	$Items['en'] = 'English';
	$Items['nl'] = 'Dutch';
	$Items['fr'] = 'French';
	$Items['de'] = 'German';
	$Items['es'] = 'Spanish';
	$Items['it'] = 'Italian';
	$Items['pl'] = 'Polish';
	$Items = array_reverse($Items);
	return $Items;
}

function GetTranslatedLanguageNames( )
{
	$languages = GetLanguages( );
	foreach ($languages as $code => $language)
		$languages[$code] = TranslationManager::GetText( $language, $code );
	return $languages;
}

function PrintLanguageButton($code, $language)
{
	?>
	<div style="float: right; display: inline-block; height: 22px; width: 28px; padding-right: 20px; padding-top: 2px">
		<?php 
		if($code == language()) 
		{ 
			?>
			<div style="position: absolute; top: 18px; width: 28px; height: 22px; border: 1px dotted #aaa; margin-top: 1px; margin-left: -1px"> </div>
			<?php 
		}
		?>
		<a href="?language=<?php print $code ?>" style="margin: 0px; padding: 0px;">
			<img src="/img/lang/<?php print $code ?>.png" height="22" width="28" 
				alt="<?php print $language ?>" title="<?php print $language ?>" 				
				style="margin: 0px; padding: 0px; border: 0px none;" />
		</a>
	</div>
	<?php 
}

?>
<div id="languages" style="top: 0;width: auto; height: 0px; overflow: visible" >
	<?php
	$Languages = GetTranslatedLanguageNames( );
	foreach ($Languages as $code => $language)
	{
		PrintLanguageButton($code, $language);
	}
	?>
</div>